package com.rimi.filter;

import javax.servlet.*;
import java.io.IOException;

/**
 * @author chengliang
 * 创建时间 2020/3/24 11:22
 */
public class EncodingFilter implements Filter {

    @Override
    public void init(FilterConfig filterConfig) throws ServletException {

    }

    @Override
    public void destroy() {

    }

    @Override
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain) throws IOException, ServletException {
        request.setCharacterEncoding("utf-8");
        response.setCharacterEncoding("utf-8");
        response.setContentType("text/html;charset=utf-8");
        //放行
        filterChain.doFilter(request,response);
    }

}
